<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .tooltip {
            position: relative;
            border-bottom: 1px dashed #000;
        }

        .tooltip::before {
            content: attr(tooltip-data);
            position: absolute;
            background-color: #efba93;
            width: 250px;
            color: white;
            text-align: center;
            line-height: 1.1;
            padding: 15px;
            border-radius: 5px;
            z-index: 1;
            bottom: 125%;
            left: 50px;
            /* margin-left: -60px; */
            transform: translateX(-50%);
            font-size: 0.7em;
            /* 不可见功能 */
            visibility: hidden;
            /* 透明度渐变效果 */
            opacity: 0;
            transition: opacity 0.5s;

        }

        .tooltip:hover::before,
        .tooltip:hover::after {
            opacity: 1;
            visibility: visible;
        }

        .tooltip::after {
            content: '';
            position: absolute;
            bottom: 75%;
            left: 50px;
            margin-left: -35px;
            border-width: 5px;
            border-style: solid;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.5s;
            border-color: #000 transparent transparent transparent;
        }
    </style>
</head>

<body>
    <h1>
        HTML/CSS tooltip
    </h1>
    <p>
        Hover
        <span class="tooltip" tooltip-data="让我康康！">Here</span>
        to display the tooltip!~
    </p>
    <p>
        Hover the
        <span class="tooltip" tooltip-data="让我康康！">Here2</span>
        to display the tooltip2!~
    </p>
</body>

</html>